package com.softstao.guoyu.mvp.presenter.shop;

import com.softstao.guoyu.model.shop.CartList;
import com.softstao.guoyu.mvp.interactor.shop.CartInteractor;
import com.softstao.guoyu.mvp.presenter.BasePresenter;
import com.softstao.guoyu.mvp.viewer.BaseViewer;
import com.softstao.guoyu.mvp.viewer.shop.AddCartViewer;
import com.softstao.guoyu.mvp.viewer.shop.CartListViewer;

/**
 * Created by vaikus on 2017/7/21.
 */

public class CartPresenter extends BasePresenter<BaseViewer,CartInteractor> {
    public void getCartList(int agentId){
        interactor.getCartList(agentId,o -> ((CartListViewer)viewer).getCartList((CartList) o));
    }

    public void addCart(int agentId,String productInfo){
        interactor.addCart(agentId,productInfo,o -> ((AddCartViewer)viewer).addResult(o));
    }

    public void updateCartList(int agentId,String productInfo){
        interactor.updateCartList(agentId,productInfo,o -> ((CartListViewer)viewer).updateResult((CartList) o));
    }
}
